<template>
    <van-row>
     <van-col :span="24">

        <van-row style="margin-top: 5px;background-color: beige;" v-for="detail in detailList" :key="detail.detailId">
            <van-col :span="24">
                <div>餐品名称：{{detail.food.foodName}}</div>
                <div>餐品数量：{{detail.quantity}}</div>
            </van-col>
        </van-row>

     </van-col>
   </van-row>
</template>
<script setup>
        //这个是根据用户id来查询这个订单的详情
        import { ref,getCurrentInstance, onMounted } from 'vue';
        import { showNotify } from 'vant';
        const {proxy} = getCurrentInstance();
        let orderId=ref(null);
        const detailList=ref([]);
        const getDetailByOrderId=()=>{
            console.log(orderId.value);
            proxy.$axios({
                method:'get',
                url:'/order/detail/'+orderId.value
            }).then(res=>{
                let resultBean=res.data;
                if(resultBean.code==200) {
                    detailList.value=resultBean.data;
                    console.log('订单详情列表-----',detailList.value);
                } else {
                    showNotify({message:resultBean.msg})
                }
            }).catch(error=>{
                showNotify({message:error.message})
            })
        }
        onMounted(()=>{
            orderId.value = proxy.$route.params.orderId;
            getDetailByOrderId();
        })
</script>